//
//  Utility.h
//  HandPay
//
//  Created by xy on 10-4-20.
//  Copyright 2010 HANDPAY. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {
    FILE_URL,
    RES_URL,
	NET_URL,
	MEMORY_URL,
    CACHE_URL,
	TEMP_URL,
	UNKNOW_URL,
} URLStype;

typedef enum {
    HPCharType_Number,                 //数字
    HPCharType_Alpha,                  //字母
    HPCharType_Alphanumeric,           //字母和数字
    HPCharType_Deafult,                // 默认
} HPCharType;

@interface Utility : NSObject {

}

+(NSString *)TreatUrl:(const char *)url withUrlTpye:(URLStype *)urltype;//*urltype= 0-file 1-res 2-net  3-cache 4-temp 5-unknow
+(UIImage*)GetImageByName:(NSString *)name withPath:(NSString *)path;//*name without "png" path= nil-image_PATH
+(NSString *)getTelephonyPhone;
+ (BOOL)isPureInt:(NSString *)string;
+ (BOOL)isPureFloat:(NSString *)string;
+(NSString*)getNowDate;
+(NSString*)getNowDateTime;
+ (BOOL)isLeapYear:(int)year;
+ (BOOL)isLegalDate:(NSString*)date;
//+(NSString*)getNowDateTest;

//yyyyMMddHHmmss 转化为 yyyy-MM-dd HH:mm:ss
+(NSString*)getFormatDate:(NSString*)date;
+(NSString*)getFormatDate:(NSString*)date format:(NSString*)format;

////yyyy-MM-dd HH:mm:ss转化为yyyyMMddHHmmss
//+(NSString*)getFormatDate2:(NSString*)date;

+ (UIControl *) currentResponseView:(UIView *)view;
+ (NSArray *) canBecomeFirstRespondersOrderedInView:(UIView *)view;
+(NSString*)formatAmount:(NSString*)str; //将3.70转为000000000370
+(NSString*)getSystemVersion;
+(NSString*)leftPadding:(NSString*)src withTotalCount:(int)count withChar:(NSString*)str;
+ (NSString*)getFormatMoneyAndSymbol:(NSString*)str; // 37000转为¥370.00
+ (NSString*)getFormatMoneyNoSymbol:(NSString*)str; // 37000转为370.00

+ (NSString*)formatAmount2:(NSString *)str;//将3701000转为3,701,000

+(NSString *)IDCardValidate:(NSString *)IDStr;
+ (BOOL)isLegalCard:(NSString *) cardNo length:(int)length;
+(NSString*)getFormatCardID:(NSString*)cardID; // 将卡号转换为4个一空格的卡号
+(NSString*)encryptCardID:(NSString*)cardID;

+(NSString*)crc32:(NSData*)data;
+(NSString*)toHexString:(NSData*)data;

+(BOOL)checkChar:(NSString*)string type:(HPCharType)type;
+ (NSString *)convertString:(NSString *)string toType:(HPCharType)type;
+(void)adjustFontSizeWithLable:(UILabel*)label size:(CGFloat)fontSize;
@end
